﻿
/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Iesi.Collections;
using Iesi.Collections.Generic;
using System.Collections.ObjectModel;

namespace VisualAgile.Model
{
    [Serializable]
    public class Release  
    {       
        /// <summary>
        /// Created Date
        /// </summary>
        public virtual DateTime CreateTime
        {
            get;
            set;
        }

        /// <summary>
        /// Created by
        /// </summary>
        public virtual System.String Creator
        {
            get;
            set;
        }

        /// <summary>
        /// Release ID
        /// </summary>
        public virtual Guid ReleaseID
        {
            get;
            set;
        }

        /// <summary>
        /// Project ID
        /// </summary>
        public virtual Guid ProjectID
        {
            get;
            set;
        }      

        /// <summary>
        /// Release name
        /// </summary>
        public virtual System.String Name
        {
            get;
            set;
        }

        /// <summary>
        /// Release period start date
        /// </summary>
        public virtual System.DateTime PeriodFrom
        {
            get;
            set;
        }

        /// <summary>
        /// Release period end date
        /// </summary>
        public virtual System.DateTime PeriodTo
        {
            get;
            set;
        }

        private ISet<Feature> _features = new HashedSet<Feature>();

        public virtual ReadOnlyCollection<Feature> Features
        {
            get { return new List<Feature>(_features).AsReadOnly(); }
        }

        public virtual void AddFeature(Feature feature)
        {
            feature.ReleaseID = this.ReleaseID.ToString();
            _features.Add(feature);
        }

        public virtual void RemoveFeature(Feature n)
        {

        }

        private ISet<Iteration> _iterations = new HashedSet<Iteration>();

        public virtual ReadOnlyCollection<Iteration> Iterations
        {
            get { return new List<Iteration>(_iterations).AsReadOnly(); }
        }

        public virtual void AddIteration(Iteration iteration)
        {
            iteration.ReleaseID = this.ReleaseID;
            _iterations.Add(iteration);
        }

        public virtual void RemoveIteration(Iteration item)
        {
            _iterations.Remove(item);
        }
    }
}
